package com.cloud.common.base.entity;

import java.io.Serializable;
import java.util.Date;

/**
 * 公共实体父类
 *
 * @author wangjian
 * @version 1.0.0.RELEASES
 * @create 2021年03月16日 3/16/21
 * @since JDK 1.8
 * Life is so short,do something to make yourself happy,such as coding
 */
public class BaseEntity implements Serializable {

    /**
     * serialVersionUID,非版本变更，否则不可随意变更
     */
    private static final long serialVersionUID = 1338111959573197207L;

    /**
     * 主键
     */
    private Long id;

    /**
     * 创建人id
     */
    private Long createdBy;

    /**
     * 创建时间
     */
    private Date createdTime;

    /**
     * 更新人id
     */
    private Long updatedBy;

    /**
     * 更新时间
     */
    private Date updatedTime;

    /**
     * 版本号
     */
    private Integer version;

    /**
     * 是否已删除
     */
    private Boolean deleted;

    /**
     * 添加时首次插入操作人信息
     *
     * @param operationId 操作人id
     */
    public void firstCreateBy(Long operationId) {
        setCreatedBy(operationId);
        setUpdatedBy(operationId);
    }

    public BaseEntity() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Long getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(Long updatedBy) {
        this.updatedBy = updatedBy;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
}
